<template>
	<view>
		<dsl-navbar title="提现申请" :bgTopImg='bgTopImg' isBack="true"></dsl-navbar>
		<view class="padding solid-bottom rowsb align-center bg-white">
			账户余额（元）
			<view class="withdraw_num">
				￥{{money||'0.00'}}
			</view>
		</view>
		<form @submit="formSubmit">
			<view class="padding solid-bottom rowsb align-center bg-white">
				提现金额
				<view class="">
					<input type="text" value="" placeholder="请输入提现金额" name='amount' />
				</view>
			</view>
			<view class="padding solid-bottom rowsb align-center bg-white">
				开户银行
				<view class="">
					<input type="text" value="" class="text-right" placeholder="暂未填写" name='bank' />
				</view>
			</view>
			<view class="padding solid-bottom rowsb align-center bg-white">
				银行卡号
				<view class="">
					<input type="text" value="" class="text-right" placeholder="暂未填写" name='account' />
				</view>
			</view>
			<view class="padding solid-bottom rowsb align-center bg-white">
				真实姓名
				<view class="">
					<input type="text" value="" class="text-right" placeholder="暂未填写" name='realName' />
				</view>
			</view>
			<view class="rowsc">
				<button form-type="submit" class="withdraw_button">
					提现申请
				</button>
			</view>
		</form>
	</view>
</template>

<script>
	import {post_apply} from '../../../../common/path.js'
	export default {
		data() {
			return {
				money: uni.getStorageSync('userInfo').money,
				bgTopImg: '#ffffff',
			}
		},
		methods: {
			//提现
			formSubmit(event) {
				let _shw = this.$tools.showToast
				let obj = event.detail.value
				if (obj.amount == '') {
					_shw('请输入提现金额')
					return
				}
				if (obj.bank == '') {
					_shw('请输入开户银行')
					return
				}
				if (obj.account == '') {
					_shw('请输入银行卡号')
					return
				}
				if (obj.realName == '') {
					_shw('请输入真实姓名')
					return
				}
				obj.userId = uni.getStorageSync('userInfo').id
				console.log(obj);
				this.Http.POST(post_apply, obj)
					.then((res) => {
						if (res.code == 0) {
							this.$tools.showToast2(res.msg)
							setTimeout(r => {
								uni.reLaunch({
									url:'/pages/user/index'
								})
							}, 1000)
						} else {
							_shw(res.msg)
						}
					})


			}
		}

	}
</script>

<style>
	.withdraw_num {
		font-size: 34rpx;
		font-weight: bold;
		color: #FE3F10;
	}

	.withdraw_annotation {
		font-size: 22rpx;
		font-weight: 500;
		line-height: 49rpx;
		color: #FE3F10;
		padding: 10rpx;
	}

	.withdraw_button {
		position: fixed;
		bottom: 30rpx;
		width: 680rpx;
		height: 100rpx;
		background: #F57604;
		border-radius: 50px;
		justify-content: center;
		display: flex;
		align-items: center;
		font-size: 36rpx;
		font-weight: 500;
		color: #FFFFFF;
	}

	input {
		font-size: 28rpx;
		text-align: right;
	}

	page {
		background: #F2EFEF;
	}
</style>
